package com.atguigu.my_aop.controller;


import cn.hutool.core.util.IdUtil;
import com.atguigu.my_aop.annotations.CustomerLogAnnotation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jmx.export.assembler.SimpleReflectiveMBeanInfoAssembler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.transform.Result;

@RestController
@Slf4j
public class CustomerController {

    @GetMapping(value = "/customer/m1")
    public String m1(){
        String result = "";

        long startTime = System.currentTimeMillis();
        System.out.println("----开始执行任务");

        //主业务逻辑
        result = IdUtil.simpleUUID();
        System.out.println("----主任务逻辑编号:" + result);
        //主任务逻辑结束

        System.out.println("----任务执行结束");
        long endTime = System.currentTimeMillis();
        System.out.println("----任务执行:" + (endTime - startTime) + "毫秒");

        return result;
    }


    @GetMapping(value = "/customer/m2")
    @CustomerLogAnnotation(value = "m2-----",enable = true)
    public String m2(){

        String result = "";

        result = IdUtil.simpleUUID();
        System.out.println("主任务业务逻辑编号:" + result);

        return  result;
    }

    @GetMapping(value = "/customer/m3")
    @CustomerLogAnnotation(value = "m3-----",enable = false)

    public String m3(){

        String result = "";

        result = IdUtil.simpleUUID();
        System.out.println("主任务业务逻辑编号m3:" + result);

        return  result;
    }
}
